package net.csdn.business.notify.common.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import net.csdn.business.notify.common.model.entity.NotifyBusiness;
import net.csdn.business.notify.common.model.query.NotifyBusinessQuery;
import net.csdn.business.notify.common.model.vo.NotifyBusinessVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 通知中心-业务配置Mapper接口
 * 
 * @author ruoyi
 * @date 2023-11-27
 */
public interface NotifyBusinessMapper extends BaseMapper<NotifyBusiness>
{

    /**
     * 分页查询通知中心-业务配置列表
     *
     * @param query 字典类型信息
     * @return 字典类型集合信息
     */
    @Select("<script> select * from notify_business where 1=1 " +
            "<if test='query.businessName != null and query.businessName!=\"\"' >" +
            " AND business_name like concat('%', #{query.businessName}, '%')" +
            "</if>" +
            "<if test='query.businessCode != null and query.businessCode!=\"\"' >" +
            " AND business_code like concat('%', #{query.businessCode}, '%')" +
            "</if>" +
            "<if test='query.notifyType != null ' >" +
            " AND notify_type=#{query.notifyType} " +
            "</if>" +
            "<if test='query.state != null ' >" +
            " AND state=#{query.state} " +
            "</if>" +
            " order by created_date desc " +
            "</script>")
    public List<NotifyBusinessVO> findPageList(Page page, @Param("query") NotifyBusinessQuery query);

    /**
     * 查询通知中心-业务配置
     * 
     * @param id 通知中心-业务配置主键
     * @return 通知中心-业务配置
     */
    @Select("<script> select * from notify_business where id= #{id} </script>")
    public NotifyBusinessVO selectNotifyBusinessById(Long id);



    @Select("<script> select * from notify_business where business_code=#{code} " +
            "<if test='state != null ' >" +
            " AND state=#{state} " +
            "</if>" +
            "</script>")
    public NotifyBusinessVO selectNotifyBusinessByCode(@Param("code")String code,@Param("state")Integer state);

    /**
     * 查询通知中心-业务配置列表
     * 
     * @param query 通知中心-业务配置
     * @return 通知中心-业务配置集合
     */
    @Select("<script> select * from notify_business where 1=1 " +
            "<if test='query.businessCode != null and query.businessCode!=\"\"' >" +
            " AND business_code like concat('%', #{query.businessCode}, '%') " +
            "</if>" +
            "<if test='query.notifyType != null ' >" +
            " AND notify_type=#{query.notifyType} " +
            "</if>" +
            "<if test='query.state != null ' >" +
            " AND state=#{query.state} " +
            "</if>" +
            " order by created_date desc " +
            "</script>")
    public List<NotifyBusinessVO> selectNotifyBusinessList(@Param("query") NotifyBusinessQuery query);




    /**
     * 删除通知中心-业务配置
     *
     * @param id 通知中心-业务配置主键
     * @return 结果
     */
    @Delete("<script> delete from notify_business where id= #{id} </script>")
    public Integer deleteNotifyBusinessById(Long id);
}
